package com.itheima.pattern.composition;


/**
 * 抽象跟节点
 */
public abstract class MenuComponent {//菜单组件
    protected String name;
    protected int level;//层级


    //添加子菜单
    public void add(MenuComponent menuComponent){
        throw new UnsupportedOperationException();
    }

    //移除子菜单
    public void remove(MenuComponent menuComponent){
        throw new UnsupportedOperationException();
    }

    //获取指定的子菜单。
    public MenuComponent getChild(int index){
        throw new UnsupportedOperationException();
    }

    //获取菜单或者菜单项名称功能
    public String getName(){
        return name;
    }

    //打印菜单名称的方法，包含子菜单和子菜单项。
    public abstract void print();
}
